<script type="text/javascript">
    function showCollectDataDetailTable(params) {
        var url = "gatewayid=" + params.gatewayid + "&" + "sensorid=" + params.sensorid + "&" + "channelid=" + params.channelid + "&" + "startTime=" + params.startTime + "&" + "endTime=" + params.endTime;
        $(function () {
            $("#title").text("亮灯情况_" + params.gatewayid + "_" + params.sensorid + "_" + params.channelid);
        })
        jQuery("#jqgrid").jqGrid({
            url: URL_PATH + "/economicBenefit/showDetail.shtml?" + url,
            contentType: 'application/json',
            datatype: "json",
            colNames: ['时间区间', '总计时间（分钟）'],
            colModel: [{
                name: 'spanTime',
                index: 'spanTime',
                align: "center",
                classes: "grid_cell",
                sortable: false
            }, {
                name: 'amount',
                index: 'amount',
                align: "center",
                classes: "grid_cell",
                sortable: false
            }],
            multiselect: false,
            loadonce: false,
            viewrecords: true,
            jsonReader: {
                root: "details",
                cell: '',
                repeatitems: false
            },
            shrinkToFit: true,
            autoScroll: true,
            hidegrid: true,
            hiddengrid: false,
            height: 260,
            width: 830,
            rownumbers: true,
            rownumWidth: 30,
            loadComplete: function () {
            }
        });

    }

    //每小时亮灯时间分布
    function everyHour() {
        // var collectDataDetails;
        if ($("#everyHour").children().size()) {
            $("#everyHour").show();
            $("#lightTime").hide();
        } else {
            $.ajax({
                contentType: "application/json",
                url: "everyHour.shtml?gatewayid=${gatewayid }&sensorid=${sensorid }&channelid=${channelid }&startTime=${startTime }&endTime=${endTime }",
                dataType: "json",
                success: function (data) {
                    _.each(data, function (item) {
                        $("#everyHour").append("<tr><td>" + item.spanTime + "</td><td>" + item.amount + "</td></tr>")
                    })
                    $("#everyHour").show();
                    $("#lightTime").hide();
                }
            })
        }
    }
</script>
<div id="showCollectDataDetailModal" class="modal  in modal_bg" style="style=" overflow: hidden; z-index: 1070; display:
     block; margin-left: -364px; height: 440px; margin-top: -219px; "">
<div class="modal-header bomb_header">
    <a class="close" data-dismiss="modal">&times;</a>

    <h3 id="title">亮灯详情</h3>
</div>
<div>
    <p><a href="javascript:lightTime();">亮灯时间段</a> | <a href="javascript:everyHour();">每小时分布</a></p>
</div>
<div style="overflow: hidden; max-height: 500px;" class="list_bg">
    <div style="overflow: hidden; margin: 10px 10px 10px 20px;">
        <div style="overflow: hidden;">
            <table id="jqgrid" class="grid_table"></table>
            <div id="pager"></div>
        </div>
    </div>
</div>
<div class="modal-footer" style="border-top:none; box-shadow:none;">
    <a href="javascript:void(0)" data-dismiss="modal" class="cancel" style="color:#2e81e9; font-size:14px;">取消</a>
</div>
</div>
